package com.zzyl.service.impl;

import com.zzyl.base.addAndUpdateBedDto;
import com.zzyl.mapper.BedMapper;
import com.zzyl.service.BedService;
import com.zzyl.vo.BedVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class BedServiceImpl implements BedService {

    @Autowired
    private BedMapper bedMapper;

    @Override
    public List<BedVo> getBedsByRoomId(Long roomId) {
        return bedMapper.getBedsByRoomId(roomId);
    }

    @Override
    public void addBed(addAndUpdateBedDto dto) {
       dto.setBedStatus(0);
       dto.setCreateTime(LocalDateTime.now());
       dto.setCreateBy("1671403256519078138");
        bedMapper.addBed(dto);
    }

    @Override
    public BedVo getBedById(Integer id) {

       return bedMapper.getBedById(id);
    }

    @Override
    public void updateBedById(addAndUpdateBedDto dto) {
        bedMapper.updateBedById(dto);
    }

    @Override
    public void deleteBedById(Integer id) {
        bedMapper.deleteBedById(id);
    }

}

